Skip to content

Fix lint errors: remove deprecated React imports and refactor nested ternaries#76

Merged
johnnyhuy merged 2 commits intosnyk-fix-86436984567a7c34273af6f435830008from
copilot/sub-pr-74-again
Jan 15, 2026
Merged

Fix lint errors: remove deprecated React imports and refactor nested ternaries#76
johnnyhuy merged 2 commits intosnyk-fix-86436984567a7c34273af6f435830008from
copilot/sub-pr-74-again

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jan 10, 2026

CI lint was failing with errors for deprecated React default imports, nested ternary expressions, and unused variables.

Changes

  • Removed deprecated React default imports - Migrated 9 icon components from import * as React and React.FC to plain function components per Backstage JSX transform migration
  • Refactored nested ternaries - Replaced with IIFE pattern for clarity:
    // Before: nested ternary
    {loading ? <Skeleton /> : items.length > 0 ? <List /> : <Empty />}
    
    // After: IIFE with if/else
    {(() => {
      if (loading) return <Skeleton />;
      if (items.length > 0) return <List />;
      return <Empty />;
    })()}
  • Removed unused variables - Cleaned up isNegative, theme, and console.error statement
  • Updated ESLint config - Added argsIgnorePattern: '^_' to support underscore-prefixed unused function parameters in type signatures
  • Unskipped test - Removed it.skip from App.test.tsx

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review any files in this pull request.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

…ernaries, remove unused vars, and update ESLint config

Co-authored-by: johnnyhuy <27847622+johnnyhuy@users.noreply.github.com>
Copilot AI changed the title [WIP] Update docker base image from debian 12-slim to 13.2-slim Fix lint errors: remove deprecated React imports and refactor nested ternaries Jan 10, 2026
Copilot AI requested a review from johnnyhuy January 10, 2026 11:23
@johnnyhuy johnnyhuy marked this pull request as ready for review January 15, 2026 04:58
@johnnyhuy johnnyhuy merged commit f2fa770 into snyk-fix-86436984567a7c34273af6f435830008 Jan 15, 2026
2 checks passed
@johnnyhuy johnnyhuy deleted the copilot/sub-pr-74-again branch January 15, 2026 04:58
@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented Jan 15, 2026

Greptile Summary

This PR resolves CI lint failures by modernizing React usage patterns and fixing code quality issues across the codebase.

Key Changes:

  • Migrated 9 icon components from deprecated import * as React and React.FC to plain function components, aligning with Backstage's JSX transform migration
  • Refactored nested ternary expressions into IIFE pattern for improved readability in HomePage.tsx and PulseCheckPage.tsx
  • Cleaned up unused variables (isNegative, theme) and replaced console.error with comment
  • Updated ESLint config to support underscore-prefixed unused function parameters
  • Unskipped previously problematic test in App.test.tsx

Considerations:
The unskipped test in App.test.tsx was previously marked as incompatible with newer Backstage versions due to app.createRoot() issues. Verify this test passes consistently in CI to ensure it doesn't introduce flakiness.

Confidence Score: 4/5

  • This PR is safe to merge with low risk after verifying test stability
  • The changes are mechanical lint fixes following established patterns. React import removals align with Backstage best practices. Nested ternary refactoring improves readability. The main concern is the unskipped test which was previously marked problematic - this needs verification in CI to ensure it doesn't cause flakiness.
  • packages/app/src/App.test.tsx requires attention - verify test passes consistently after unskipping

Important Files Changed

Filename Overview
packages/app/.eslintrc.js Added argsIgnorePattern: '^_' to allow underscore-prefixed unused function parameters
packages/app/src/App.test.tsx Unskipped test that was marked as problematic with app.createRoot() in newer versions
packages/app/src/components/home/HomePage.tsx Refactored 3 nested ternaries to IIFE pattern, removed console.error statement

Sequence Diagram

sequenceDiagram
    participant Dev as Developer
    participant CI as CI Pipeline
    participant ESLint as ESLint
    participant Icons as Icon Components
    participant Pages as Page Components
    
    Dev->>CI: Push changes (before PR)
    CI->>ESLint: Run lint check
    ESLint->>Icons: Check icon files
    Icons-->>ESLint: Error: deprecated React imports
    ESLint->>Pages: Check page files
    Pages-->>ESLint: Error: nested ternaries
    Pages-->>ESLint: Error: unused variables
    ESLint-->>CI: Lint failed ❌
    CI-->>Dev: CI failed
    
    Dev->>Icons: Remove React imports, React.FC
    Dev->>Pages: Refactor ternaries to IIFE
    Dev->>Pages: Remove unused variables
    Dev->>ESLint: Update config (argsIgnorePattern)
    
    Dev->>CI: Push fixes (this PR)
    CI->>ESLint: Run lint check
    ESLint->>Icons: Validate plain function components
    Icons-->>ESLint: Pass ✓
    ESLint->>Pages: Validate IIFE pattern
    Pages-->>ESLint: Pass ✓
    ESLint-->>CI: All checks passed ✓
    CI-->>Dev: CI succeeded
Loading

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants